package com.sinosoft.tcmemr.manager.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.sinosoft.tcmemr.dao.DoctorUserEntityMapper;
import com.sinosoft.tcmemr.entity.DoctorUserEntity;
import com.sinosoft.tcmemr.manager.DoctorUserManager;

@Component
public class DoctorUserManagerImpl implements DoctorUserManager {
	@Autowired
	private DoctorUserEntityMapper doctorUserMapper;
	
	/**
	 * 通过用户名得到医生用户信息
	 * @param userName
	 * @return DoctorUserEntity
	 */
	public DoctorUserEntity getDoctorByUserName(String userName){
		return doctorUserMapper.getDoctorByUserName(userName);
	}
	/**
	 * 通过ID得到医生用户信息
	 * @param id
	 * @return DoctorUserEntity
	 */
	public DoctorUserEntity getDoctorByPrimaryKey(Integer id){
		return doctorUserMapper.getDoctorByPrimaryKey(id);
	}
	/**
	 * 添加医生用户信息
	 * @param doctoruser
	 * @return true/false
	 */
	public boolean addDoctorUser(DoctorUserEntity doctoruser){
		if ( doctoruser == null ){
			return false;
		}
		doctorUserMapper.addDoctorUser(doctoruser);
		return true;
	}
	/**
	 * 更新医生用户信息
	 * @param doctoruser
	 * @return true/false
	 */
	public boolean updateDoctorUser(DoctorUserEntity doctoruser){
		if ( doctoruser == null ){
			return false;
		}
		doctorUserMapper.updateDoctorUser(doctoruser);
		return true;
	}
	/**
	 * 删除医生用户信息
	 * @param id 用户ID
	 * @return true/false
	 */
	public boolean deleteByPrimaryKey(Integer id){
		doctorUserMapper.deleteByPrimaryKey(id);
		return true;
	}
}
